<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>管理</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/own.css" />
		<link rel="stylesheet" href="../css/iconfont.css" />
		<script type="text/javascript" src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="../js/common.js"></script>
		
	</head>

	<body style="font-size: 0.8rem;">
		<header class="mui-bar own-mui-bar-nav own-main-background-color ">
			<h1 class="mui-title">管理</h1>
		</header>
		<div class="mui-content">
				<ul class="mui-table-view mui-grid-view mui-grid-9" style="background: #FFFFFF;" id="ul_str">
					<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" id="A" style="display: none;">
		                    <span class="mui-icon iconfont icon-component"></span>
		                    <div class="mui-media-body">单元工程</div>
		            </li>
		             <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" id="B" style="display: none;">
		                    <span class="mui-icon iconfont icon-mobanguanli"></span>
		                    <div class="mui-media-body">新建仓</div>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" id="C" style="display: none;">
		                    <span class="mui-icon iconfont icon-yingyongguanli"></span>
		                    <div class="mui-media-body">新建单元</div>
		            </li>
		        </ul> 
		</div>
	</body>
	<script>
	    
	    var indexview = null;
	    
		mui.init();
		
        
		mui.plusReady(function() {
			
			indexview = plus.webview.currentWebview();
			
		
			mpms_ajax({'node':localStorage.getItem('node')},'getNodeData',function(data){
				
					if(data.data.menu.length>0){
						//存储node节点数据
				            	if(data.data.menu[data.data.menu.length-1].list.length>0){
				            		for (let value of data.data.menu[data.data.menu.length-1].list) {
						                 	if(value.title.indexOf('单元工程') !=-1){
						                 		$('#A').show();
						                 	}else if(value.title.indexOf('新建仓') !=-1){
						                 		$('#B').show();
						                 	}else if(value.title.indexOf('新建单元') !=-1){
						                 		$('#C').show();
						                 	}
						                 }
				            	}
					}
				  });
			
			document.getElementById('A').addEventListener('tap',function () {
				getPagetoken();
				gotoSumPage('unit_list.html?A');
			})
			
			document.getElementById('B').addEventListener('tap',function () {
				getPagetoken();
			     gotoSumPage('house_info.html?'+ localStorage.getItem('node'));
			})
			
			document.getElementById('C').addEventListener('tap',function () {
				 getPagetoken();
			     gotoSumPage('unit_info.html?'+ localStorage.getItem('node'));   
			})
			
			
			var first = null;
			mui.back = function() {
				//首次按键，提示‘再按一次退出应用’
				if(!first) {
					first = new Date().getTime();
					mui.toast('再按一次退出应用');
					setTimeout(function() {
						first = null;
					}, 1000);
				} else {
					if(new Date().getTime() - first < 1000) {
						plus.runtime.quit();
					}
				}
			};

		});

		
	</script>

</html>